<template>
  <div class="app-container calendar-list-container">
    <div class="filter-container">
      <el-input class="filter-item" @keyup.enter.native="handleFilter" style="width: 200px;" placeholder="请输入关键词" v-model="search.keyword"></el-input>
      <el-button class="filter-item" v-waves icon="el-icon-search" @click="handleFilter">搜索</el-button>
    </div>
    <el-table v-loading="!pload" ref="multipleTable" border :data="tableData">
      <el-table-column type="selection" width="55" align="center">
      </el-table-column>
      <el-table-column property="alisName" label="别名" align="center" show-overflow-tooltip width="200">
      </el-table-column>
      <el-table-column property="urlPath" label="静态网址" align="center" show-overflow-tooltip>
      </el-table-column>
      <el-table-column label="日期" align="center" width="180" show-overflow-tooltip>
        <template slot-scope="scope">
          {{scope.row.lastModifiedDate | parseTime('{y}-{m}-{d} {h}:{i}:{s}')}}
        </template>
      </el-table-column>
    </el-table>
    <div class="pagination-container">
      <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-size="limit" :page-sizes="limits" background layout="sizes, prev, pager, next, jumper, total" :total="count">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import * as api from '@/utils/api'
import waves from '@/directive/waves' // 水波纹指令
export default {
  directives: {
    waves
  },
  data() {
    return {
      tableData: [],
      search: {
        keyword: ''
      },
      selection: [],
      selectTable: {},
      pload: false,
      currentPage: 1,
      limit: 1000,
      limits: [10, 20, 50, 100, 1000],
      count: 0
    }
  },
  components: {
  },
  created() {
    this.getData()
  },
  methods: {
    async getData() {
      const data = this.JSONo(
        {
          pageNum: this.currentPage,
          pageSize: this.limit
        },
        this.search
      )
      this.pload = false
      const Datas = await api.sysLog(data)
      this.tableData = Datas
      this.count = Datas.length
      this.pload = true
    },
    handleFilter() {
      this.currentPage = 0
      this.getData()
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`)
      this.limit = val
      this.getData()
    },
    handleCurrentChange(val) {
      this.currentPage = val
      this.getData()
    }
  }
}
</script>
